<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject
{
    use Notifiable;

    public function userProducts()
    {
        return $this->hasMany(UserProducts::class);
    }

    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    public function getJWTCustomClaims()
    {
        return [];
    }

    public function getGenderAttribute($value)
    {
        switch ($value) {
            case 1:
                return '男';
                break;
            case 2:
                return '女';
                break;
            default:
                return '未知';
                break;
        }
    }
}
